﻿using FreeSql.DataAnnotations;
using FreeSqlLearn;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace FreesqlLearn.Entity.Model
{
	/// <summary>
	/// 员工/工作人员 账号
	/// </summary>
    [JsonObject(MemberSerialization.OptIn), Table(DisableSyncStructure = false)]
    public class EmployeeAccount
    {
		/// <summary>
		/// 雪花算法ID
		/// </summary>
		[Snowflake]
		[JsonProperty, Column(IsPrimary = true)]
		public long Id { get; set; }

		/// <summary>
		/// 账号
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string UserName { get; set; }
		/// <summary>
		/// 姓名
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string Name { get; set; }
		/// <summary>
		/// 身份证号
		/// </summary>
		[JsonProperty, Column(StringLength = 18)]
		public string IdCard { get; set; }
		/// <summary>
		/// 密码
		/// </summary>
		[JsonProperty, Column(StringLength = 100)]
		public string PassWord { get; set; }
		/// <summary>
		/// 手机号
		/// </summary>
		[JsonProperty, Column(StringLength = 11)]
		public string Mobile { get; set; }
		/// <summary>
		/// 版本号
		/// </summary>
		[JsonProperty, Column(IsVersion = true)]
		public int SysVersion { get; set; }
		/// <summary>
		/// 创建时间
		/// </summary>
		[JsonProperty, Column(CanInsert = true, CanUpdate = false, ServerTime = DateTimeKind.Local)]
		public DateTime CreateTime { get; set; }
		/// <summary>
		/// 更新时间
		/// </summary>
		[JsonProperty, Column(CanInsert = true, CanUpdate = true, ServerTime = DateTimeKind.Local)]
		public DateTime UpdateTime { get; set; }

		/// <summary>
		/// 累加登录失败次数
		/// </summary>
		[JsonProperty]
		public int ErrorLoginTimes { get; set; }
		/// <summary>
		/// 是否禁用
		/// </summary>
		[JsonProperty]
		public bool IsForbidden { get; set; }
		/// <summary>
		/// 禁用时间
		/// </summary>
		[JsonProperty]
		public DateTime ForbiddenTime { get; set; }
		/// <summary>
		/// 最后禁用原因
		/// </summary>
		[JsonProperty, Column(StringLength = 250)]
		public string ForbiddenReason { get; set; }
	}
}
